package com.itheima.tlias84.mapper;

import com.itheima.tlias84.dto.SelectAllDeptDTO;
import com.itheima.tlias84.dto.SelectAllEmpDTO;
import com.itheima.tlias84.dto.SelectEmpDTO;
import com.itheima.tlias84.dto.SelectEmpDatailDTO;
import com.itheima.tlias84.entity.Emp;
import com.itheima.tlias84.po.InsertEmpParam;
import com.itheima.tlias84.po.SelectEmpPageParam;
import com.itheima.tlias84.po.UpdateEmpParam;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Mapper -- 》mybatis提供
 * @Repository -- >由Spring提供的注解
 */
//@Repository
@Mapper
public interface EmpMapper {


    List<SelectEmpDTO> selectEmpByPage(@Param("p")SelectEmpPageParam param);

    int deleteEmpByIds(@Param("ids")List<Integer> ids );

     int insertEmp(@Param("p")InsertEmpParam param);

     int updateEmp(@Param("p")UpdateEmpParam updateEmpParam);
     SelectEmpDatailDTO selectEmpById(@Param("id") Integer id);
     List<SelectAllEmpDTO> selectAllEmp();
    @Select("select id , username , password , name from emp where username = #{username}")
    Emp selectEmpByUsername(@Param("username") String username);

    List<Integer> countEmpByJob();
}
